package com.test;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.methods.GetMethod;


public class thread extends Thread{
	
	public static String URL = "";
	
	private final int SIZE = 1000000;
	
	public void run(){
		
		if(URL.equals("")){
			System.out.println("*********** 输入URL错误 ***********");
			return;
		}
		
		int i = SIZE;
		
		while(i > 0){
			
			try{
			HttpClient client = new HttpClient();   
			
//			HttpMethod method = new GetMethod("http://kyfw.12306.cn/otn/lcxxcx/query?purpose_codes=ADULT&queryDate=2014-01-27&from_station=VNP&to_station=ZZF");
			
//			HttpMethod method = new GetMethod("http://kyfw.12306.cn/otn/leftTicket/query?leftTicketDTO.train_date=2014-01-27&leftTicketDTO.from_station=BJP&leftTicketDTO.to_station=ZZF&purpose_codes=ADULT");
			
			HttpMethod method = new GetMethod(URL);
			
			client.executeMethod(method);
			
			System.out.println("("+i+")"+method.getStatusLine());
			
			if(i == SIZE){
				System.out.println(method.getResponseBodyAsString());
			}
			
			}catch (Exception e) {
				e.printStackTrace();
			}
			
			i = i-1;
		}
		
		
	}
}
